package com.huluobo.high3demo.home.items;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.huluobo.mvvm.baen.BannerBeanResult;
import com.huluobo.mvvm.baen.GoodsBeanResult;
import com.huluobo.mvvm.viewmodel.BaseViewModel;

/**
 * Created by LC on 2023/9/18.
 */
public class ItemViewModel extends BaseViewModel<ItemRepo> {

    MutableLiveData<BannerBeanResult> bannerSuccess = new MutableLiveData<>();

    MutableLiveData<String> bannerFailed = new MutableLiveData<>();

    MutableLiveData<GoodsBeanResult> goodsSuccess = new MutableLiveData<>();

    MutableLiveData<String> goodsFailed = new MutableLiveData<>();

    public ItemViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    protected ItemRepo createRepo() {
        return new ItemRepo();
    }

    public void loadBanner() {
        repo.loadBanner(bannerSuccess, bannerFailed);
    }

    public void loadGoods(int categoryId, int currentPage, int pageSize) {
        repo.loadGoods(categoryId, currentPage, pageSize, goodsSuccess, goodsFailed);
    }
}
